﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace markdown_picture_packer.backend
{
    public class Range
    {
        //起始值
        public readonly int Start;
        //结束值
        public readonly int End;
        public Range(int start, int end)
        {
            Start = start;
            End = end;
        }
        // 判断给定的值是否在范围内
        public bool InRange(int value)
        {
            return Start <= value && value <= End;
        }
        // 判断给定的值是否在任何指定的范围内
        public static bool InRanges(List<Range> ranges, int value)
        {
            return ranges.Any(range => range.InRange(value));
        }
    }
}
